<template>
  <div>
    <p>List</p>
    <ul>
      <li v-for="item in List" :key="item.id">姓名-{{item.name}}年龄-{{item.age}}</li>
    </ul>
    <button @click="sendDataToParent">向父组件传递数据</button>
  </div>
</template>

<script>
export default {
  name: "List",
  data() {
    return {
      List: [
        { id: "001", name: "laoliu", age: 37 },
        { id: "002", name: "xiangyang", age: 35 },
        { id: "003", name: "awei", age: 38 },
      ],
    };
  },
  methods: {
    sendDataToParent() {
      this.$emit("sendData", this.List);
    },
  },
};
</script>

<style>
</style>